<template>
  <div>
    <ToolBarComponent ref="fileUploadBar">
      <FileUploadComponent input-lable="文件上传" input-name="fileKey"></FileUploadComponent>
      <span class="sql-gen-notice">* 上传只支持xlsx格式</span>
    </ToolBarComponent>
    <ButtonBarRowComponent>
      <Button text="文件导入" :click-function="importEmcyData"/>
    </ButtonBarRowComponent>
  </div>
</template>

<script>
import ButtonBarRowComponent from "@/components/button/ButtonBarRowComponent";
import Button from "@/components/button/ButtonComponent";
import FileUploadComponent from "@/components/input/FileUploadComponent";
import ToolBarComponent from "@/components/toolbar/ToolBarComponent";
import {postRequest} from "@/axio2";

export default {
  name: "EmcyImportPage",
  components: {Button, ButtonBarRowComponent, FileUploadComponent, ToolBarComponent},
  methods:{
    importEmcyData:function (){
      let param = this.$refs["fileUploadBar"].getSubmitParams();
      param["fileSuffix"]="xlsx";
      postRequest(
          'emcy/dataImport.do',
          param,
          null,
          null,
          this
      );
    }
  }
}
</script>
<style scoped>
.sql-gen-notice{
  color: red;
}
</style>